<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title>GEarthExtensions Samples - GEarthExtensions#fx.Animation</title>
  <script src="http://www.google.com/jsapi?key=ABQIAAAAsc0UQXoo2BnAJLhtpWCJFBTgHOxFyKCf35LCvsI_n4URElrkIhS9MkSlm_0NZWgrKFkOsnd5rEK0Lg" type="text/javascript"></script>
  <script src="../dist/extensions.js" type="text/javascript"></script>
<script type="text/javascript">
/* <![CDATA[ */

var ge = null;
var gex = null;

google.load('earth', '1');

google.setOnLoadCallback(function() {
  google.earth.createInstance('map3d', function(pluginInstance) {
    ge = pluginInstance;
    ge.getWindow().setVisibility(true);
    ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
    
    gex = new GEarthExtensions(pluginInstance);
    
  }, function() {});
});


/* ]]> */
</script>
</head>
<body>
  <div id="map3d_container" style="width: 500px; height: 500px;">
    <div id="map3d" style="height: 100%"></div>
  </div>
<textarea id="code" style="font-family: monospace; width: 500px; height: 200px;">
gex.util.takeOverCamera();
var lookAt = gex.util.getLookAt();
var startLon = lookAt.getLongitude();

var anim = new gex.fx.Animation(function(t) {
  lookAt.setLongitude(startLon + t / 100);
  ge.getView().setAbstractView(lookAt);

  // if (t >= 5000)
  //  this.stop();
}, function() {
  gex.util.takeOverCamera(false);
});

anim.start();
setTimeout(function(){ anim.stop(); }, 2000);
</textarea><br/>
<input type="button" onclick="eval(document.getElementById('code').value);" value="Run"/>
</body>
</html>
